﻿using System;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            Shape cir = new Circle();
            Shape squ = new Square();

            Test(cir);
            Test(squ);
        }
        public static void PlanB() 
        {
            Shape shape = new Shape();
            Square square = new Square();       //父类引用 指向子类实例
            Circle circle = new Circle();

            shape.GetArea();
            if (shape.Type == "正方形")
            {
                square.GetArea();
            }
            else if (shape.Type == "圆形")
            {
                circle.GetArea();
            }
        }

        public static void Test(Shape shape) //参数为父类 调用传入子类
        {
            shape.GetArea();


        }
    }
}
